<style type="text/css">
#first {
	font-size: 18px;
}
#second {
	font-size: 14px;
}
</style>
<div class="content">
	<?php
	if($attachments != array()) {
		foreach($attachments as $attachment) {
			$excelFileName = $attachmentPath.$attachment['section'].'/'.substr($attachment['alias'], 0, 1).'/'.$attachment['alias'].'/'.$attachment['filename'];
		}
	}
	$ext = substr(strrchr($excelFileName, '.'), 1);
	if($ext == 'xls') {
		include 'scripts/PHPExcel.php';
		include 'scripts/PHPExcel/Reader/Excel2007.php';
		$excel = new PHPExcel_Reader_Excel5();
	} else {
		if($ext == 'xlsx') {
			include 'scripts/PHPExcel.php';
			include 'scripts/PHPExcel/Reader/Excel2007.php';
			$excel = new PHPExcel_Reader_Excel2007();
		}
	}
	if(is_file($excelFileName)):
	$book = $excel->load($excelFileName);
	$page = $book->getActiveSheet();
	$col = $page->getHighestColumn();
	//echo $colNum . "<br />";
	$rowNum = $page->getHighestRow();
	//echo $rowNum . "<br />";
	$colNum = PHPExcel_Cell::columnIndexFromString($col);
	print '<table border="1" class="excelTable" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="head1" colspan="7" align="left" nowrap="nowrap" id="first"><strong>Leasable Properties Report</strong></td>
		<td class="border" colspan="3" nowrap="nowrap" id="second"><strong></strong></td>
		<td class="border" colspan="3" nowrap="nowrap"></td>
		<td class="border">&nbsp;</td>
		<td class="border">&nbsp;</td>
		<td class="border">&nbsp;</td>
		<td class="border">&nbsp;</td>
	  </tr>
	  <tr>
		<td class="border">&nbsp;</td>
		<td class="head3" colspan="5" align="center" valign="middle" nowrap="nowrap"><strong>PRIORITY INFORMATION</strong></td>
		<td class="border" colspan="2" nowrap="nowrap"><strong>Delegate Agency:</strong></td>
		<td class="border" colspan="6" nowrap="nowrap">West Town Chicago Chamber of Commerce</td>
		<td class="border">&nbsp;</td>
		<td class="border">&nbsp;</td>
		<td class="border">&nbsp;</td>
	  </tr>
	  <tr>
		<td class="head2 bottom" width="12" align="center"><strong>Ct.</strong></td>
		<td class="head3 bottom center" colspan="3" align="center"><strong>Location</strong></td>
		<td class="head3 bottom" width="12" align="center"><strong>Asset Type</strong></td>
		<td class="head3 bottom" width="12" align="center"><strong>Square Footage</strong></td>
		<td class="head2 bottom" width="12" align="center"><strong>Rental $/SF</strong></td>
		<td class="head2 bottom" width="12" align="center"><strong>CAM+ Taxes/SF</strong></td>
		<td class="head2 bottom" width="12" align="center"><strong>Zoning</strong></td>
		<td class="head2 bottom" colspan="3" align="center"><strong>Status</strong></td>
		<td class="head2 bottom" width="12" align="center"><strong>Comments/Next Steps</strong></td>
		<td class="head2 bottom" colspan="4" align="center"><strong>Contact Information</strong></td>
	  </tr>
	  <tr>
		<td class="head2 bottom" width="12" align="center">&nbsp;</td>
		<td class="head3 bottom" width="12" align="center">Number</td>
		<td class="head3 bottom" width="12" align="center">Direction</td>
		<td class="head3 bottom" width="12" align="center">Street</td>
		<td class="head3 bottom" width="12" align="center">Commercial, Office, Vacant, etc.</td>
		<td class="head3 bottom" width="12" align="center">&nbsp;</td>
		<td class="head2 bottom" width="12" align="center">&nbsp;</td>
		<td class="head2 bottom" width="12" align="center">&nbsp;</td>
		<td class="head2 bottom" width="12" align="center">&nbsp;</td>
		<td class="head2 bottom" width="12" align="center">For Lease</td>
		<td class="head2 bottom" width="12" align="center">For Sale</td>
		<td class="head2 bottom" width="12" align="center">Other</td>
		<td class="head2 bottom" width="12" align="center">&nbsp;</td>
		<td class="head2 bottom" width="12" align="center">Name</td>
		<td class="head2 bottom" width="12" align="center">Affiliation (property owner, management company, developer, etc.)</td>
		<td class="head2 bottom" width="12" align="center">Phone</td>
		<td class="head2 bottom" width="12" align="center">Email</td>
	  </tr>';
	for($i = 5; $i <= $rowNum; ++$i) {
		print '<tr>';
		for($j = 0; $j <= $colNum - 1; ++$j) {
			print '<td class="attach" nowrap="nowrap">';
			if($page->getCellByColumnAndRow($j, $i)->getValue() != '') {
				if(preg_match("|^[-a-zA-Z0-9._]+[@]{1}[-a-zA-Z0-9.]+[a-zA-Z]{2,4}$|",
						$page->getCellByColumnAndRow($j, $i)->getValue())) {
					print '<a href="mailto:'
						. $page->getCellByColumnAndRow($j, $i)->getValue()
						. '">' . $page->getCellByColumnAndRow($j, $i)->getValue()
						. "</a>";
				} else {
					if(preg_match('#^[-a-z0-9]+(\.[-a-z0-9]+)*(\.[a-z]+)(|\/|\/([a-z0-9-_\(\)!\&\#\.\/\~]+(\.[a-z0-9\_\-]+)?(\?([a-zа-я0-9-_\%]*|([a-z0-9_-]+=[a-zа-я0-9-_\%\&]*)+))?(\#[a-z0-9]*)?)?)$#i',
						$page->getCellByColumnAndRow($j, $i)->getValue())) {
						print '<a href="http://' . $page->getCellByColumnAndRow($j, $i)->getValue() . '">'
							. $page->getCellByColumnAndRow($j, $i)->getValue()
								. '</a>';
					} else {
						print $page->getCellByColumnAndRow($j, $i)->getValue();
					}
				}
			}
			print "</td>";
		}
		print "</tr>";
	}
	print "</table>";
?>
<?php else: ?>
<p>No items in this category</p>
<?php endif; ?>
</div>